package com.ruoyi.common.newAdd.returnResult;




import java.text.MessageFormat;

/**
 * 自定义异常类型
 * @author:wangchao
 */

public class CustomException extends RuntimeException {

    //错误代码
    ResultCode resultCode;

    public CustomException(ResultCode resultCode){
        super(resultCode.msg());
        this.resultCode = resultCode;
    }

    public CustomException(ResultCode resultCode, Object... args){
        super(resultCode.msg());
        String msg = MessageFormat.format(resultCode.msg(), args);
        resultCode.setMessage(msg);
        this.resultCode = resultCode;
    }

    public ResultCode getResultCode(){
        return resultCode;
    }

}